//
//  TodayMainTableViewCell.m
//  OAProject
//
//  Created by yhj on 2017/2/22.
//  Copyright © 2017年 cdnunion. All rights reserved.
//

#import "TodayMainTableViewCell.h"

@interface TodayMainTableViewCell ()

// 头像
@property(nonatomic,strong)UIImageView *headURL;

// 名字
@property(nonatomic,strong)UILabel *nameLabel;

@end

@implementation TodayMainTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        // ➡️Cell类型
        self.accessoryType=UITableViewCellAccessoryNone;

        self.headURL.hidden=NO;

        _headURL.image=[UIImage imageNamed:@"goal_head"];

        self.nameLabel.font=Font_Number(18);

        self.backgroundColor=WhiteColor;

    }
    return self;
}

// headURL
-(UIImageView *)headURL
{
    if (!_headURL) {
        _headURL=[[UIImageView alloc]init];
        [self.contentView addSubview:_headURL];
        // 圆角和边框
        ViewBorderRadius(_headURL,kmargin*5/2,kmargin/kmargin,ClearColor);

        [_headURL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(kmargin*2);
            make.centerY.mas_equalTo(self);
            make.size.mas_equalTo(CGSizeMake(kmargin*5,kmargin*5));
        }];
    }
    return _headURL;
}

// nameLabel
- (UILabel *)nameLabel
{

    if (!_nameLabel) {
        _nameLabel=[self getLabelWithText:@"写100行代码" font:Font_Number(16) textColor:Color909090 textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
        [self.contentView addSubview:_nameLabel];
        [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.headURL.mas_right).offset(kmargin);
            make.centerY.mas_equalTo(self);
            make.right.mas_equalTo(-kmargin);
        }];
    }
    return _nameLabel;
}

@end
